#pragma once
#include "StdAfx.h"
#include "tinyxml.h"
class myVisitor : public TiXmlVisitor
{
public:
	myVisitor():resSult(0)
	{
	}
	virtual ~myVisitor() {}

	/// Visit a document.
	virtual bool VisitEnter( const TiXmlDocument& doc )		
	{
		if (strcmp(szStr ,doc.Value())==0)
		{
			resSult = &doc;
			return false;
		}
		return true; 
	}

	/// Visit an element.
	virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute )
	{
		if (strcmp(szStr ,element.Value())==0&&
			strcmp(szNamePro,((TiXmlElement)element).Attribute("name")) ==0) 
		{
			resSult = &element;
			return false;
		}
		return true; 
	}

	char szStr[256];
	char szNamePro[256];
	const TiXmlNode * resSult;
};